import cv2
import numpy as np
if __name__ == '__main__':
    image=cv2.imread('C:\\Users\\20436\Desktop\weishengzhi.jpg')
    angle=-43
    scale=0.5

    M=cv2.getRotationMatrix2D(
        (500,500),
        angle,
        scale
    )
    rotation_image=cv2.warpAffine(
        image,
        M,
        (image.shape[1],image.shape[0]),
        flags=cv2.INTER_NEAREST,
        borderMode=cv2.BORDER_CONSTANT
    )
    cv2.imshow('rotation_image', rotation_image)
    cv2.imwrite('rotation_image.jpg', rotation_image)
    cv2.waitKey(0)




